﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TreeManagement
{
    public partial class InformationPanel : UserControl
    {
        public InformationPanel()
        {
            InitializeComponent();
        }       
        private void btnNew_Click(object sender, EventArgs e)
        {
           if(this.Tag is WardForm)
            {
                    EditWardForm frm = new EditWardForm();
                    frm.FormType = ActionType.NEW_WARD;
                    frm.EditWardFormParent = (Form)this.Tag;
                    frm.ShowDialog();
            }
        }

        private void InformationPanel_Load(object sender, EventArgs e)
        {
            if (this.Tag is WardForm)
            {
                using (var context = new TreeDBEntities())
                {
                    dgvView.DataSource = context.Wards.ToList();
                }
            }
        }
    }
}
